function LoadJson(jsonFile, onUpdate)
    local MyScene = class("MyScene", function()
        return cc.Scene:create()
    end)
    MyScene.__index = MyScene
    function MyScene:ctor()
        local function myOnUpdate()
            if next(self.data.remove) then
                for k,v in pairs(self.data.remove) do
                    k:removeFromParent();
                    self.data.remove[k] = nil;
                end
            end
            if self.data.removeExitScene then
                self.data.removeExitScene:removeFromParent();
                self.data.removeExitScene = nil;                
            end
            if onUpdate then
                onUpdate();
            end
        end
        self:scheduleUpdateWithPriorityLua(myOnUpdate, 0)
    end
    local scene = MyScene.new();
    scene.data = {remove={}};
    
    local function onKeyPressed(keyCode, event)
    end

    local function onKeyReleased(keyCode, event)
        if keyCode == cc.KeyCode.KEY_BACK then
            PauseScene()
            local ck = os.clock();
            local exitScene = LoadJson("exit.json");
            local function returnCallBack(sender, eventType)
                if eventType == ccui.TouchEventType.ended then
                    scene.data.removeExitScene = exitScene;
                    if g_Data.startCk then
                        ck = os.clock() - ck;
                        g_Data.startCk = g_Data.startCk + ck;
                    end
                    ResumeScene();
                end
            end
            local button = exitScene.layer:getChildByName("return")
            button:addTouchEventListener(returnCallBack)

            local function okCallBack(sender, eventType)
                if eventType == ccui.TouchEventType.ended then
                    cc.Director:getInstance():endToLua();
                end
            end
            local button = exitScene.layer:getChildByName("ok")
            button:addTouchEventListener(okCallBack)
            
            scene:addChild(exitScene,100);
        end
    end

    local listener = cc.EventListenerKeyboard:create()
    listener:registerScriptHandler(onKeyPressed, cc.Handler.EVENT_KEYBOARD_PRESSED)
    listener:registerScriptHandler(onKeyReleased, cc.Handler.EVENT_KEYBOARD_RELEASED)
    scene:getEventDispatcher():addEventListenerWithSceneGraphPriority(listener, scene)
    
    --加载json
    scene.layer = ccs.GUIReader:getInstance():widgetFromJsonFile(jsonFile)
    if scene.layer then
        scene:addChild(scene.layer)
        local function TraverseNode(node)
            local f = node.getString;
            if f then
                local n = node:getString();
                for k,v in pairs(EXCEL.langUI) do
                    if n == k then
                        node:setString(v[EXCEL.const.lang])
                        break;
                    end
                end
            end
            local childs = node:getChildren();
            for i=1, #childs do
                TraverseNode(childs[i]);
            end
        end
        TraverseNode(scene.layer)
    end
    
    return scene;
end


